with Ada.Numerics.Long_Elementary_Functions;
use Ada.Numerics.Long_Elementary_Functions;
with Ada.Text_Io; use Ada.Text_IO;

package body Maths_Utilities is

   function Solve (A, B, C : in long_float) return Solution_Type is
      D : long_float;
      S : Solution_Type;
   begin
      if A = 0.0 then
         if B = 0.0 then
            S.Genre := Aucune;
            return S;
         else --B/=0
            S.Genre := Simple;
            S.X1 := - C / B;
            return S;
         end if;

      else --A/=0
         D := B ** 2- 4.0 * A *C;
         if D > 0.0 then
            S.X1 := (-B - Sqrt (D)) / (2.0 * A);
            S.X2 := (-B + Sqrt (D)) / (2.0 * A);
            S.Genre := Double;
         elsif D = 0.0 then
            S.X1 := -B / (2.0 * A);
            S.Genre := Simple;
         else
            S.Genre := Aucune;
         end if;
      end if;
      return S;
   end Solve;


end Maths_Utilities;
